package com.skt.exception;

import lombok.Getter;

@Getter
public enum CostumeErrorCode implements ErrorCode {

    // ========== 通用商品错误 (30xxx) ==========
    COSTUME_OPERATION_FAILED(30001, "商品操作失败"),
    COSTUME_NOT_FOUND(30002, "商品不存在"),
    COSTUME_ACCESS_DENIED(30003, "无权访问该商品"),
    COSTUME_DATA_CORRUPTED(30004, "商品数据异常"),

    // ========== 查询相关 (301xx) ==========
    QUERY_COSTUME_FAILED(30101, "查询商品失败"),
    QUERY_COSTUME_LIST_FAILED(30102, "查询商品列表失败"),
    QUERY_COSTUME_DETAIL_FAILED(30103, "查询商品详情失败"),
    SEARCH_COSTUME_FAILED(30104, "搜索商品失败"),

    // ========== 分页参数相关 (302xx) ==========
    INVALID_PAGE_PARAM(30201, "分页参数无效"),
    PAGE_NUMBER_INVALID(30202, "页码必须大于0"),
    PAGE_SIZE_INVALID(30203, "每页大小必须在1-100之间"),
    PAGE_SIZE_TOO_LARGE(30204, "每页大小超出最大限制"),

    // ========== 搜索参数相关 (303xx) ==========
    SEARCH_KEYWORD_EMPTY(30301, "搜索关键词不能为空"),
    SEARCH_KEYWORD_TOO_LONG(30302, "搜索关键词过长"),
    INVALID_SEARCH_CATEGORY(30303, "搜索分类无效"),
    INVALID_SEARCH_FILTER(30304, "搜索筛选条件无效"),
    SEARCH_PARAMS_INVALID(30305, "搜索参数格式错误"),

    // ========== 商品状态相关 (304xx) ==========
    COSTUME_NOT_AVAILABLE(30401, "商品已下架"),
    COSTUME_OUT_OF_STOCK(30402, "商品已售罄"),
    COSTUME_UNDER_MAINTENANCE(30403, "商品维护中"),
    COSTUME_DELETED(30404, "商品已被删除"),
    COSTUME_DRAFT(30405, "商品为草稿状态"),

    // ========== 商户相关 (305xx) ==========
    MERCHANT_NOT_FOUND(30501, "商户不存在"),
    MERCHANT_DISABLED(30502, "商户已被禁用"),
    MERCHANT_COSTUME_NOT_FOUND(30503, "该商户下未找到指定商品"),

    // ========== 分类相关 (306xx) ==========
    CATEGORY_NOT_FOUND(30601, "商品分类不存在"),
    CATEGORY_DISABLED(30602, "商品分类已禁用"),
    INVALID_CATEGORY_HIERARCHY(30603, "商品分类层级错误"),

    // ========== 排序相关 (307xx) ==========
    INVALID_SORT_FIELD(30701, "排序字段无效"),
    INVALID_SORT_ORDER(30702, "排序顺序无效"),
    UNSUPPORTED_SORT_TYPE(30703, "不支持的排序类型"),

    // ========== 价格范围相关 (308xx) ==========
    INVALID_PRICE_RANGE(30801, "价格范围无效"),
    MIN_PRICE_GREATER_THAN_MAX(30802, "最低价格不能大于最高价格"),
    PRICE_RANGE_TOO_LARGE(30803, "价格范围过大"),

    // ========== 租赁参数相关 (309xx) ==========
    INVALID_RENTAL_DAYS(30901, "租赁天数无效"),
    MIN_RENTAL_DAYS_EXCEEDED(30902, "未达到最小租赁天数"),
    MAX_RENTAL_DAYS_EXCEEDED(30903, "超过最大租赁天数"),

    // ========== 数据返回相关 (310xx) ==========
    EMPTY_RESULT_SET(31001, "未找到符合条件的商品"),
    TOO_MANY_RESULTS(31002, "搜索结果过多，请添加筛选条件"),
    RESULT_SIZE_EXCEEDED(31003, "返回结果数量超出限制"),

    // ========== 缓存相关 (311xx) ==========
    COSTUME_CACHE_FAILED(31101, "商品缓存操作失败"),
    COSTUME_CACHE_EXPIRED(31102, "商品缓存已过期"),
    CACHE_REFRESH_FAILED(31103, "缓存刷新失败"),

    // ========== 并发查询相关 (312xx) ==========
    CONCURRENT_QUERY_LIMIT(31201, "并发查询次数超限"),
    QUERY_TIMEOUT(31202, "查询超时，请稍后重试"),
    DATABASE_CONNECTION_FAILED(31203, "数据库连接失败"),

    // ========== 库存相关 (313xx) ==========
    INSUFFICIENT_STOCK(31301, "库存不足"),
    STOCK_UPDATE_FAILED(31302, "库存更新失败"),
    STOCK_VALIDATION_FAILED(31303, "库存验证失败"),

    // ========== 价格相关 (314xx) ==========
    PRICE_CALCULATION_FAILED(31402, "价格计算失败"),
    PRICE_SNAPSHOT_INVALID(31403, "价格快照无效"),

    // ========== 商家商品模块 - 创建相关 (315xx) ==========
    CREATE_COSTUME_FAILED(31501, "创建商品失败"),
    COSTUME_NAME_EMPTY(31502, "商品名称不能为空"),
    COSTUME_NAME_TOO_LONG(31503, "商品名称过长"),
    COSTUME_DESCRIPTION_EMPTY(31504, "商品描述不能为空"),
    COSTUME_DESCRIPTION_TOO_LONG(31505, "商品描述过长"),
    COSTUME_CATEGORY_INVALID(31506, "商品分类无效"),
    COSTUME_PRICE_INVALID(31507, "商品价格无效"),
    COSTUME_RENTAL_PRICE_INVALID(31508, "商品租赁价格无效"),
    COSTUME_STOCK_INVALID(31509, "商品库存数量无效"),
    COSTUME_IMAGES_EMPTY(31510, "商品图片不能为空"),
    COSTUME_IMAGES_TOO_MANY(31511, "商品图片数量超出限制"),
    COSTUME_BRAND_INVALID(31512, "商品品牌信息无效"),
    COSTUME_SIZE_INVALID(31513, "商品尺码信息无效"),
    COSTUME_COLOR_INVALID(31514, "商品颜色信息无效"),
    COSTUME_DUPLICATE_NAME(31515, "商品名称已存在"),
    COSTUME_CREATE_LIMIT_EXCEEDED(31516, "商品创建数量超出限制"),
    COSTUME_PURCHASE_DATE_INVALID(31517, "商品购入日期无效"),

    // ========== 商家商品模块 - 更新相关 (316xx) ==========
    UPDATE_COSTUME_FAILED(31601, "更新商品失败"),
    COSTUME_UPDATE_DATA_EMPTY(31602, "更新数据不能为空"),
    COSTUME_STATUS_UPDATE_INVALID(31603, "商品状态更新无效"),
    COSTUME_CANNOT_UPDATE_UNDER_REVIEW(31604, "审核中的商品不能修改"),
    COSTUME_CANNOT_UPDATE_RENTED(31605, "已租出的商品不能修改"),
    COSTUME_UPDATE_VERSION_CONFLICT(31606, "商品数据版本冲突"),
    COSTUME_UPDATE_FIELD_INVALID(31607, "商品更新字段无效"),
    COSTUME_UPDATE_REQUIRES_REAUDIT(31608, "商品修改需要重新审核"),
    COSTUME_UPDATE_STOCK_INVALID(31609, "商品库存更新无效"),

    // ========== 商家商品模块 - 查询相关 (317xx) ==========
    QUERY_MERCHANT_COSTUME_LIST_FAILED(31701, "查询商家商品列表失败"),
    MERCHANT_COSTUME_QUERY_PARAM_INVALID(31702, "商家商品查询参数无效"),
    MERCHANT_COSTUME_STATUS_FILTER_INVALID(31703, "商家商品状态筛选条件无效"),
    MERCHANT_COSTUME_SORT_FIELD_INVALID(31704, "商家商品排序字段无效"),
    MERCHANT_COSTUME_QUERY_UNAUTHORIZED(31705, "无权查询其他商家商品"),

    // ========== 商家商品模块 - 权限相关 (318xx) ==========
    UNAUTHORIZED_ACCESS(31801, "未授权访问"),
    FORBIDDEN_ACCESS(31802, "禁止访问"),
    MERCHANT_PERMISSION_DENIED(31803, "商家权限不足"),
    MERCHANT_ACCOUNT_DISABLED(31804, "商家账号已被禁用"),
    MERCHANT_SUSPENDED(31805, "商家账号已被暂停"),

    // ========== 商家商品模块 - 审核相关 (319xx) ==========
    COSTUME_AUDIT_REQUIRED(31901, "商品需要审核"),
    COSTUME_AUDIT_STATUS_INVALID(31902, "商品审核状态无效"),
    COSTUME_AUDIT_REJECTED(31903, "商品审核未通过"),
    COSTUME_AUDIT_PENDING(31904, "商品审核中"),
    COSTUME_AUDIT_REMARK_TOO_LONG(31905, "审核备注过长"),

    // ========== 商家商品模块 - 文件相关 (320xx) ==========
    COSTUME_IMAGE_UPLOAD_FAILED(32001, "商品图片上传失败"),
    COSTUME_IMAGE_FORMAT_INVALID(32002, "商品图片格式无效"),
    COSTUME_IMAGE_SIZE_TOO_LARGE(32003, "商品图片大小超出限制"),
    COSTUME_IMAGE_COUNT_EXCEEDED(32004, "商品图片数量超出限制"),
    COSTUME_IMAGE_PROCESSING_FAILED(32005, "商品图片处理失败");

    private final int code;
    private final String message;

    CostumeErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }
}